/**
	解析配置工具
	2013-08-06
*/
var filterCondition = null;	//全局条件
var startPage = 1;			//起始	
var pageRowCount = 20; 		//每页数

/**
	声明配置信息对象
*/
var pageparam = {};				//配置对象
pageparam.tags = {};			//存储配置信息
////////////////////////////////////////////////////////////////////
/**
	声明收集配置信息存储对象
*/
pageparam.exceldata = [];		//excel导出数据库字段名	
pageparam.exceldatashow = [];	//excel导出显示标题
pageparam.database = [];		//查询数据库表字段名
pageparam.subdatabase = [];		//subtag
pageparam.datashow = [];		//shw
pageparam.datashowobj = {}; 	//tag
pageparam.keyArrays = [];		//key

pageparam.title = "正在加载...";
pageparam.businame = "";	
pageparam.order = "sorder";	

function loadColumnDefine(){
	var retVal = [];
	
	for (var pidx in pageparam.tags)
	{
		var define = pageparam.tags[pidx];
		
		var obj = {};
		obj.tag = define["tag"] ? define["tag"]  : "" ;
		obj.name = define["shw"] ? define["shw"]  : "" ;
		obj.width = define["siz"] ? define["siz"] : 120;
		obj.id = define["id"] ? define["id"] : null ;
		obj.hidden = define["hidden"] ? define["hidden"] : false ;
		obj.editor = define["editor"] ? define["editor"] : null;
		obj.align = define["align"] ? define["align"] : null;
		obj.renderer = define["renderer"] ? define["renderer"] : null;
		obj.noquery = define["noquery"] ? define["noquery"] : false;
		obj.locked = define["locked"] ? define["locked"] : null;
		
		obj.rowspan = define["rowspan"] ? define["rowspan"] : null;
		obj.select_filter = define["select_filter"] ? define["select_filter"] : null;
		obj.text_filter = define["text_filter"] ? define["text_filter"] : null;
		obj.fieldname = define["fieldname"] ? define["fieldname"] : null;
		obj.color = define["color"] ? define["color"] : null;
		retVal.push(obj);
		
		var stag = define["tag"] ? define["tag"] : define["shw"];
		var stagshow = define["shw"] ? define["shw"] : define["tag"];
		pageparam.database.push(stag);
		if(!obj.hidden) {
			pageparam.exceldata.push(stag);
			pageparam.exceldatashow.push(stagshow);
		}
		
		var subtag = define["subtag"] ? define["subtag"] : stag;
		pageparam.subdatabase.push(subtag);
		var show = define["shw"] ? define["shw"] : define["tag"];
		pageparam.datashow.push(show);
		pageparam.datashowobj[show] = stag;
 		var key = define["key"] ? define["key"] : false;
 		if(key) pageparam.keyArrays.push(stag);
	}
	return retVal;
}

function initpageparam(){
	pageparam.defines = loadColumnDefine();
	var cond = filterCondition;
	var dataflds = pageparam.database.join(",");
	var flds = dataflds;
	var flds1 = pageparam.subdatabase.join(",");
	var busiobj = {};
	busiobj.tableName = pageparam.businame;
	busiobj.flds = flds;
	busiobj.flds1 = flds1;
	busiobj.cond = cond ? cond : "";
	busiobj.order = pageparam.order ? pageparam.order : "data_order";
	pageparam.busiobj = busiobj;
}